package com.pktechan.api.enumeration;

/**
 * Created by qx.zhangbj02320 on 2018/5/24.
 */
public enum WxPayTradeStateEnum {
    INITIAL("INITIAL", "初始状态"), SUCCESS("SUCCESS", "支付成功"), REFUND("REFUND", "转入退款"), NOT_PAY("NOTPAY", "未支付"),
    CLOSED("CLOSED", "已关闭"), REVOKED("REVOKED", "已撤销（刷卡支付"), USER_PAYING("USERPAYING", "用户支付中"), PAY_ERROR("PAYERROR", "支付失败(其他原因，如银行返回失败)");

    private String code;
    private String name;

    public static String getTradeStateName(String code) {
        for (WxPayTradeStateEnum wxPayTradeStateEnum : WxPayTradeStateEnum.values()) {
            if (wxPayTradeStateEnum.getCode().equals(code)) {
                return wxPayTradeStateEnum.name;
            }
        }
        return null;
    }

    WxPayTradeStateEnum(String code, String name) {
        this.code = code;
        this.name = name;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }
}
